package com.bjpowernode.money.model;

import java.io.Serializable;

/**
 * @author ZHAOZHENYU
 * @since 2022/10/15
 */
public class PageModel implements Serializable {

    private Integer firstPage = 1;

    private Long lastPage;

    private Long currentPage;

    private Integer pageSize = 10;

    private Long total;

    public PageModel() {
    }

    public PageModel(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getFirstPage() {
        return firstPage;
    }

    public void setFirstPage(Integer firstPage) {
        this.firstPage = firstPage;
    }

    /**
     * 总页数即最后一页 通过总条数和页面大小计算得出
     * @return
     */
    public Long getLastPage() {
        return total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
    }

    public Long getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Long currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
